import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Login',
    redirect:'/login'  //重定向
  },
  {
    path: '/register',
    name: 'Register',
    component: ()=>import('../views/Register.vue')
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/home',
    name: 'Home',
    component: ()=>import('../views/Home.vue'),
    children:[
        {
            path: 'maintest',
            name: 'MainTest',
            component: ()=>import('../views/MainTest.vue'),
            meta:{
                title:'测试页面'
            }
          },
          {
            path: 'main',
            name: 'Main',
            meta:{
                title:'显示页面'
            },
            component: ()=>import('../views/Main.vue')
          },
          {
            path: '/edit/:id',
            name: 'Edit',
            component: ()=>import('../views/Edit.vue')
          },
          {
            path: '/editnew',
            name: 'EditNew',
            component: ()=>import('../views/EditNew.vue')
          }
    ]

  }
]

const router = new VueRouter({
  routes
})

export default router
